package top.gongtao.helloservice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

import com.netflix.discovery.shared.Application;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


//通过 @EnableDiscoveryClient 注解让该应用注册为 Eureka 客户端应用，已获得服务发现的能力。
@EnableDiscoveryClient
@SpringBootApplication
public class ConsumerApplication {

	@Bean
	@LoadBalanced		//通过 @LoadBalanced 注解开启客户端负载均衡
	RestTemplate restTemplate(){
		return new RestTemplate();
	}

	public static void main(String[] args) {
		SpringApplication.run(ConsumerApplication.class, args);
	}
}
